package self.niu.com.resume.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

import java.util.ArrayList;
import java.util.List;

import self.niu.com.resume.R;
import self.niu.com.resume.db.Projects;
import self.niu.com.resume.db.dbHeple.DbHander;

public class YuWeiActivity extends AppCompatActivity {
    @ViewInject(R.id.pro_name_tv)
    private TextView proName;
    @ViewInject(R.id.pro_time_tv)
    private TextView proTime;
    @ViewInject(R.id.pro_tool_tv)
    private TextView proTool;
    @ViewInject(R.id.pro_summary_tv)
    private TextView proSummary;
    @ViewInject(R.id.pro_technic_tv)
    private TextView proTechnic;

    private List<Projects> listDatas;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_yu_wei);
        ViewUtils.inject(this);
        initView();

    }

    private void initView() {
        int postion = getIntent().getIntExtra("type", 0);
        listDatas = new ArrayList<>();
        getData(listDatas);
        setData(getData(listDatas), postion);

    }

    private void setData(List<Projects> list, int postion) {
        Projects pro = list.get(postion);
        proName.setText(pro.getProName());
        proSummary.setText(pro.getProSummary());
        proTime.setText(pro.getProTime());
        proTechnic.setText(pro.getProTechnic());
        proTool.setText(pro.getProTool());

    }

    public List<Projects> getData(List<Projects> list) {
        list.addAll(DbHander.getInstance().findProjectAll());
        return list;
    }
}
